package cn.ggcms.cms.dao.impl;

import java.util.List;

import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;

import cn.ggcms.cms.dao.LinksDao;
import cn.ggcms.cms.utils.SimpleDao;
import cn.ggcms.cms.vo.Links;

public class LinksImpl extends SimpleDao<Links> implements LinksDao {

	public boolean doDeleteLink(int id) {
		boolean flag = false;
		try {
			super.delete(Links.class, id);
			flag=true;
		} catch (Exception e) {
			e.printStackTrace();
		}

		return flag;
	}

	public int doInsertLink(Links links) {
		return super.save(links);
	}

	public boolean doUpdateLinks(Links links) {
		boolean flag = false;
		try {
			super.update(links);
			flag=true;
		} catch (Exception e) {
			e.printStackTrace();
		}

		return flag;

	}

	public List<Links> findLinks() {
		return super.setMaxResults(0).find(Links.class, Order.desc("orders"));
	}

	public Links findLinksById(int id) {

		return super.get(Links.class, id);
	}

	public List<Links> searchLinks(Links links) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Links> searchLinks(Criterion... criteria) {
		// TODO Auto-generated method stub
		return super.find(Links.class,criteria);
	}

}
